﻿@using System.Collections
@model IEnumerable<HotelManageSystem.Models.RoomInfoModel>

@{
    ViewBag.Title = "ShowAllRoom";
    Layout = "~/Views/Shared/_Template2.cshtml";
}
@section Head
{
    <link href="../../Content/TelerikGrid.css" rel="stylesheet" type="text/css" />
}
@{
    Html.Telerik().Grid(Model).Name("Grid").DataKeys(key=>key.Add(r=>r.ID))
                              .ToolBar(command=>command.Insert())
                              .DataBinding(dataBind=>dataBind.Ajax()
                                                             .OperationMode(GridOperationMode.Client)
                                                             .Select("TelerikAjaxToShow","Room")
                                                             .Delete("DeleteRoom","Room")
                                                             .Update("UpdateRoom", "Room")
                                                             .Insert("AddRoom", "Room"))
                              .Columns(columns=>
                                           {
                                               columns.Bound(r => r.ID).Title("房间编号").Width(50).HtmlAttributes(new { style = "text-align:center" });
                                               columns.Bound(r => r.Name).Title("房间名称").Width(50).HtmlAttributes(new { style = "text-align:center" });
                                               columns.Bound(r => r.BedNum).Title("床数量").Width(50).HtmlAttributes(new { style = "text-align:center" });
                                               columns.Bound(r => r.RoomTypeName).Title("房间类型").Width(50).HtmlAttributes(new { style = "text-align:center" });
                                               columns.Bound(r => r.FloorName).Title("楼层").Width(50).HtmlAttributes(new { style = "text-align:center" });
                                               columns.Bound(r => r.RoomStateName).Title("房态").Width(50).HtmlAttributes(new { style = "text-align:center" });
                                               columns.Command(command =>
                                                                   {
                                                                       command.Edit().ButtonType(GridButtonType.ImageAndText);
                                                                       command.Delete().ButtonType(GridButtonType.ImageAndText);
                                                                   }
                                                               ).Width(200).HtmlAttributes(new { style = "text-align:center" }).Title("操作");
                                           }
                                      )
                              .Editable(e => e.Mode(GridEditMode.PopUp))
                              .Pageable(page=>page.Style(GridPagerStyles.NextPreviousAndNumeric)
                                                                        .Position(GridPagerPosition.Bottom)
                                                                        .PageSize(12))
                              .Sortable()
                              .Filterable()
                              .Render();
                            
}